<?php

namespace app\controller;

use app\logic\MenuLogic;
use think\App;
use think\Response;

class Menu extends Base
{
    /**
     * @var MenuLogic
     */
    private MenuLogic $menuLogic;

    /**
     * @param App $app
     * @param MenuLogic $menuLogic
     */
    public function __construct(App $app, MenuLogic $menuLogic)
    {
        parent::__construct($app);
        $this->menuLogic = $menuLogic;
    }

    /**
     * @return Response
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getMenu(): Response
    {
        $pid = $this->request->post('pid/d', 0);
        $result = $this->menuLogic->getMenuList($pid);
        return $this->success($result);
    }
}